package com.subway.babynote.syncservice;

import com.subway.babynote.syncdata.errMessage;

public class localdatahandler {
	
	public int handlecmd(RunnableTask task,int code, int ts)
	{
		int iret = 0;
		switch(code)
		{
			case syncapi.operation_code.regUser:			
			case syncapi.operation_code.loginUser:
				break;
			case syncapi.operation_code.regVisitor:
			case syncapi.operation_code.changeUserInfo:				
			case syncapi.operation_code.addFeedback:
			case syncapi.operation_code.addFeedRecord:
			case syncapi.operation_code.getFeeds:
			case syncapi.operation_code.getFoodprop:
			case syncapi.operation_code.getFoods:
			case syncapi.operation_code.get_food_default:
			case syncapi.operation_code.get_food_ux:
			case syncapi.operation_code.get_h_default:
			case syncapi.operation_code.get_h_ux:
			case syncapi.operation_code.get_w_default:
			case syncapi.operation_code.get_w_ux:
			case syncapi.operation_code.geth:
			case syncapi.operation_code.getw:
			case syncapi.operation_code.getLastAverage:
			case syncapi.operation_code.getcontact:
			case syncapi.operation_code.getloadinfo:
			case syncapi.operation_code.addh:
			case syncapi.operation_code.addw:
			case syncapi.operation_code.getts2:
			case syncapi.operation_code.getts:
			case syncapi.operation_code.getTip:
			case syncapi.operation_code.syncweibo:
			{
				iret = this.signal_worker(task, code, ts);
				break;
			}
			default:
				iret = errMessage.err_inputcode.errcode;
				
		}
		return iret;
	}
	
	private int signal_worker(RunnableTask task, int code, int ts)
	{
		boolean bret = task.set_work_state(code, ts);
		if(bret)
			return 0;
		else
			return -1;
	}

}
